package com.b2c.mapper;

import com.mr.service.pojo.BrandEntity;
import com.mr.service.pojo.CategoryEntity;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface BrandMapper extends tk.mybatis.mapper.common.Mapper<BrandEntity>{

    @Insert("INSERT INTO tb_category_brand (category_id, brand_id) VALUES (#{cid},#{bid})")
    int  insertCategoryBrand(@Param("cid")Long cid, @Param("bid")Long bid);

    @Delete("DELETE from tb_category_brand  where  brand_id=#{bid}")
    public int delBrandCateByBid(@Param("bid") Long bid);

    @Select("SELECT * from tb_brand where id in(SELECT brand_id from tb_category_brand where category_id=#{cid})")
    List<BrandEntity> queryBrandByCid(Long cid);

    List<CategoryEntity> selectByIdList(List<Long> ids);
}
